import request from '@/utils/request'
import {AddResponse} from '@/api/enroll/type'

enum API {
    ENROLLINFOLIST_URL = '/mobile/enrollInfoListPage/',
    ENROLLINFOBYTITLE = '/mobile/enrollInfoListPage/',
    UPLOADIMG_URL = '/upload',
    ADDENROLL='/mobile/addEnrollInfo',
    BATCHDELETE_URL = '/mobile/batchDeleteEnrollInfo?enrollInfoArr=',
    ADDORUPDATEENROLL = '/mobile/addOrUpdateEnrollInfo',
    DELETEENROLLBYID = '/mobile/deleteEnrollInfoById/',
}

export const reqEnrollInfoList = (currentPage: number, limit: number) => request.get(API.ENROLLINFOLIST_URL + `${currentPage}/${limit}`)

export const reqEnrollByTitle = (
    currentPage: number,
    limit: number,
    enrollTitle: String,
) => request.get(API.ENROLLINFOBYTITLE + `${currentPage}/${limit}/${enrollTitle}`)

export const reqImgUpload = (fileObj:any) => 
    request.post(API.UPLOADIMG_URL,fileObj)


export const addEnrollInfo =(EnrollParams:any)=>
    request.post<any,AddResponse>(API.ADDENROLL,EnrollParams)

export const reqBatchDeleteEnrollInfo = (ids:any)=>
    request.delete<any,AddResponse>(API.BATCHDELETE_URL + `${ids}`)

export const addOrUpdateEnrollInfo=(EnrollParams:any)=>
    request.post<any,AddResponse>(API.ADDORUPDATEENROLL,EnrollParams)

export const reqDeleteEnrollById = (deleteId:any)=>
    request.post(API.DELETEENROLLBYID + `${deleteId}`)